package com.bush.mall.member.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.member.entity.GrowthChangeHistoryEntity;
import com.bush.mall.member.service.GrowthChangeHistoryService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 成长值变化历史记录
 * @author RUN
 * @date 2022-11-29
 */
@RestController
@RequestMapping("growthchangehistory")
@Api(tags = "成长值变化历史记录管理" )
public class GrowthChangeHistoryController {

    @Resource(name= GrowthChangeHistoryService.BEAN_ID)
    private GrowthChangeHistoryService growthChangeHistoryService;

    /**
     * 分页查询成长值变化历史记录列表
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "分页查询成长值变化历史记录列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return growthChangeHistoryService.queryForPage(current,size);
    }

    /**
     * 保存成长值变化历史记录表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "保存成长值变化历史记录表单")
    @PostMapping
    public Result saveGrowthChangeHistory(@RequestBody GrowthChangeHistoryEntity growthChangeHistory){
        return growthChangeHistoryService.saveGrowthChangeHistory(growthChangeHistory);
    }

    /**
     * 修改成长值变化历史记录表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "修改成长值变化历史记录表单")
    @PutMapping
    public Result updateGrowthChangeHistory(@RequestBody GrowthChangeHistoryEntity growthChangeHistory){
        return growthChangeHistoryService.updateGrowthChangeHistory(growthChangeHistory);
    }

    /**
     * 通过指定id删除成长值变化历史记录
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "通过指定id删除成长值变化历史记录")
    @DeleteMapping
    public Result deleteGrowthChangeHistory(Long id){
        return growthChangeHistoryService.deleteGrowthChangeHistory(id);
    }

}
